mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Fix participant list call state
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
8d15a4b671
commit
39a848afa4
@ -37,6 +37,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
|
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
|
||||||
import com.nextcloud.talk.models.json.participants.Participant;
|
import com.nextcloud.talk.models.json.participants.Participant;
|
||||||
|
import com.nextcloud.talk.models.json.participants.Participant.InCallFlags;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
import com.nextcloud.talk.utils.DisplayUtils;
|
import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
|
|
||||||
@ -186,56 +187,24 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
|
|||||||
Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources();
|
Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources();
|
||||||
|
|
||||||
if (header == null) {
|
if (header == null) {
|
||||||
Participant.ParticipantFlags participantFlags = participant.getParticipantFlags();
|
Long inCallFlag = participant.getInCall();
|
||||||
switch (participantFlags) {
|
if ((inCallFlag & InCallFlags.WITH_PHONE) > 0) {
|
||||||
case NOT_IN_CALL:
|
holder.videoCallIconView.setImageResource(R.drawable.ic_call_grey_600_24dp);
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.GONE);
|
holder.videoCallIconView.setVisibility(View.VISIBLE);
|
||||||
holder.videoCallImageView.setVisibility(View.GONE);
|
holder.videoCallIconView.setContentDescription(
|
||||||
break;
|
resources.getString(R.string.nc_call_state_with_phone, participant.displayName));
|
||||||
case IN_CALL:
|
} else if ((inCallFlag & InCallFlags.WITH_VIDEO) > 0) {
|
||||||
holder.voiceOrSimpleCallImageView.setBackground(
|
holder.videoCallIconView.setImageResource(R.drawable.ic_videocam_grey_600_24dp);
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_call_bubble, null));
|
holder.videoCallIconView.setVisibility(View.VISIBLE);
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
|
holder.videoCallIconView.setContentDescription(
|
||||||
holder.voiceOrSimpleCallImageView.setContentDescription(
|
resources.getString(R.string.nc_call_state_with_video, participant.displayName));
|
||||||
resources.getString(R.string.nc_call_state_in_call, participant.displayName));
|
} else if (inCallFlag > InCallFlags.DISCONNECTED) {
|
||||||
holder.videoCallImageView.setVisibility(View.GONE);
|
holder.videoCallIconView.setImageResource(R.drawable.ic_mic_grey_600_24dp);
|
||||||
break;
|
holder.videoCallIconView.setVisibility(View.VISIBLE);
|
||||||
case IN_CALL_WITH_AUDIO:
|
holder.videoCallIconView.setContentDescription(
|
||||||
holder.voiceOrSimpleCallImageView.setBackground(
|
resources.getString(R.string.nc_call_state_in_call, participant.displayName));
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_voice_bubble, null));
|
} else {
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
|
holder.videoCallIconView.setVisibility(View.GONE);
|
||||||
holder.voiceOrSimpleCallImageView.setContentDescription(
|
|
||||||
resources.getString(R.string.nc_call_state_in_call_with_audio, participant.displayName));
|
|
||||||
holder.videoCallImageView.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
case IN_CALL_WITH_VIDEO:
|
|
||||||
holder.voiceOrSimpleCallImageView.setBackground(
|
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_call_bubble, null));
|
|
||||||
holder.videoCallImageView.setBackground(
|
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_video_bubble, null));
|
|
||||||
holder.voiceOrSimpleCallImageView.setContentDescription(
|
|
||||||
resources.getString(R.string.nc_call_state_in_call, participant.displayName));
|
|
||||||
holder.videoCallImageView.setContentDescription(
|
|
||||||
resources.getString(R.string.nc_call_state_with_video, participant.displayName));
|
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
|
|
||||||
holder.videoCallImageView.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
|
||||||
case IN_CALL_WITH_AUDIO_AND_VIDEO:
|
|
||||||
holder.voiceOrSimpleCallImageView.setBackground(
|
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_voice_bubble, null));
|
|
||||||
holder.videoCallImageView.setBackground(
|
|
||||||
ResourcesCompat.getDrawable(resources, R.drawable.shape_video_bubble, null));
|
|
||||||
holder.voiceOrSimpleCallImageView.setContentDescription(
|
|
||||||
resources.getString(R.string.nc_call_state_in_call_with_audio));
|
|
||||||
holder.videoCallImageView.setContentDescription(
|
|
||||||
resources.getString(R.string.nc_call_state_with_video));
|
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE);
|
|
||||||
holder.videoCallImageView.setVisibility(View.VISIBLE);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
holder.voiceOrSimpleCallImageView.setVisibility(View.GONE);
|
|
||||||
holder.videoCallImageView.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holder.contactMentionId != null) {
|
if (holder.contactMentionId != null) {
|
||||||
@ -302,11 +271,8 @@ public class UserItem extends AbstractFlexibleItem<UserItem.UserItemViewHolder>
|
|||||||
@BindView(R.id.secondary_text)
|
@BindView(R.id.secondary_text)
|
||||||
public EmojiTextView contactMentionId;
|
public EmojiTextView contactMentionId;
|
||||||
@Nullable
|
@Nullable
|
||||||
@BindView(R.id.voiceOrSimpleCallImageView)
|
@BindView(R.id.videoCallIcon)
|
||||||
ImageView voiceOrSimpleCallImageView;
|
ImageView videoCallIconView;
|
||||||
@Nullable
|
|
||||||
@BindView(R.id.videoCallImageView)
|
|
||||||
ImageView videoCallImageView;
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@BindView(R.id.checkedImageView)
|
@BindView(R.id.checkedImageView)
|
||||||
ImageView checkedImageView;
|
ImageView checkedImageView;
|
||||||
|
@ -146,8 +146,19 @@ public class Participant {
|
|||||||
return sessionIds;
|
return sessionIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getInCall() {
|
public Long getInCall() {
|
||||||
return this.inCall;
|
if (inCall instanceof Long) {
|
||||||
|
return (Long) this.inCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.inCall instanceof Boolean) {
|
||||||
|
if ((boolean) inCall) {
|
||||||
|
return 1L;
|
||||||
|
} else {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSource() {
|
public String getSource() {
|
||||||
@ -327,6 +338,15 @@ public class Participant {
|
|||||||
GUEST_MODERATOR
|
GUEST_MODERATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class InCallFlags {
|
||||||
|
public static final int DISCONNECTED = 0;
|
||||||
|
public static final int IN_CALL = 1;
|
||||||
|
public static final int WITH_AUDIO = 2;
|
||||||
|
public static final int WITH_VIDEO = 4;
|
||||||
|
public static final int WITH_PHONE = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public enum ParticipantFlags {
|
public enum ParticipantFlags {
|
||||||
NOT_IN_CALL(0),
|
NOT_IN_CALL(0),
|
||||||
IN_CALL(1),
|
IN_CALL(1),
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Nextcloud Talk application
|
|
||||||
~
|
|
||||||
~ @author Mario Danic
|
|
||||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape
|
|
||||||
android:shape="oval">
|
|
||||||
<solid android:color="@color/white"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:drawable="@drawable/ic_call_grey_600_24dp"/>
|
|
||||||
</layer-list>
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Nextcloud Talk application
|
|
||||||
~
|
|
||||||
~ @author Mario Danic
|
|
||||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape
|
|
||||||
android:shape="oval">
|
|
||||||
<solid android:color="@color/white"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:drawable="@drawable/ic_star_black_24dp" android:tint="@color/grey_600"/>
|
|
||||||
</layer-list>
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Nextcloud Talk application
|
|
||||||
~
|
|
||||||
~ @author Mario Danic
|
|
||||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape
|
|
||||||
android:shape="oval">
|
|
||||||
<solid android:color="@color/bg_default"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:drawable="@drawable/ic_lock_grey600_24px"/>
|
|
||||||
</layer-list>
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Nextcloud Talk application
|
|
||||||
~
|
|
||||||
~ @author Mario Danic
|
|
||||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape
|
|
||||||
android:shape="oval">
|
|
||||||
<solid android:color="@color/bg_default"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:drawable="@drawable/ic_videocam_grey_600_24dp"/>
|
|
||||||
</layer-list>
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Nextcloud Talk application
|
|
||||||
~
|
|
||||||
~ @author Mario Danic
|
|
||||||
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
|
||||||
~
|
|
||||||
~ This program is free software: you can redistribute it and/or modify
|
|
||||||
~ it under the terms of the GNU General Public License as published by
|
|
||||||
~ the Free Software Foundation, either version 3 of the License, or
|
|
||||||
~ at your option) any later version.
|
|
||||||
~
|
|
||||||
~ This program is distributed in the hope that it will be useful,
|
|
||||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
~ GNU General Public License for more details.
|
|
||||||
~
|
|
||||||
~ You should have received a copy of the GNU General Public License
|
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item>
|
|
||||||
<shape
|
|
||||||
android:shape="oval">
|
|
||||||
<solid android:color="@color/bg_default"/>
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item android:drawable="@drawable/ic_mic_grey_600_24dp"/>
|
|
||||||
</layer-list>
|
|
@ -25,40 +25,27 @@
|
|||||||
android:layout_height="@dimen/item_height"
|
android:layout_height="@dimen/item_height"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/frame_layout"
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
android:layout_width="wrap_content"
|
android:id="@+id/simple_drawee_view"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="@dimen/avatar_size"
|
||||||
|
android:layout_height="@dimen/avatar_size"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="@dimen/activity_horizontal_margin">
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
|
app:roundAsCircle="true" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/voiceOrSimpleCallImageView"
|
android:id="@+id/videoCallIcon"
|
||||||
android:layout_width="12dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="12dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_alignParentEnd="true"
|
||||||
android:background="@drawable/shape_lock_bubble"
|
android:layout_centerVertical="true"
|
||||||
android:contentDescription="@null"
|
android:layout_centerInParent="true"
|
||||||
android:visibility="gone"
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
tools:visibility="visible" />
|
android:src="@drawable/ic_videocam_grey_600_24dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
<ImageView
|
android:visibility="gone"
|
||||||
android:id="@+id/videoCallImageView"
|
tools:visibility="visible" />
|
||||||
android:layout_width="12dp"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:layout_gravity="top|end"
|
|
||||||
android:background="@drawable/shape_favorite_bubble"
|
|
||||||
android:contentDescription="@null"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<com.facebook.drawee.view.SimpleDraweeView
|
|
||||||
android:id="@+id/simple_drawee_view"
|
|
||||||
android:layout_width="@dimen/avatar_size"
|
|
||||||
android:layout_height="@dimen/avatar_size"
|
|
||||||
app:roundAsCircle="true" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/linear_layout"
|
android:id="@+id/linear_layout"
|
||||||
@ -67,7 +54,8 @@
|
|||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_marginStart="@dimen/margin_between_elements"
|
android:layout_marginStart="@dimen/margin_between_elements"
|
||||||
android:layout_marginEnd="@dimen/margin_between_elements"
|
android:layout_marginEnd="@dimen/margin_between_elements"
|
||||||
android:layout_toEndOf="@id/frame_layout"
|
android:layout_toEndOf="@id/simple_drawee_view"
|
||||||
|
android:layout_toStartOf="@id/videoCallIcon"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.emoji.widget.EmojiTextView
|
<androidx.emoji.widget.EmojiTextView
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
<string name="nc_offline">Currently offline, please check your connectivity</string>
|
<string name="nc_offline">Currently offline, please check your connectivity</string>
|
||||||
<string name="nc_leaving_call">Leaving call…</string>
|
<string name="nc_leaving_call">Leaving call…</string>
|
||||||
<string name="nc_call_state_in_call">%1$s in call</string>
|
<string name="nc_call_state_in_call">%1$s in call</string>
|
||||||
<string name="nc_call_state_in_call_with_audio">%1$s in call with audio</string>
|
<string name="nc_call_state_with_phone">%1$s with phone</string>
|
||||||
<string name="nc_call_state_with_video">%1$s with video</string>
|
<string name="nc_call_state_with_video">%1$s with video</string>
|
||||||
|
|
||||||
<!-- Notification channels -->
|
<!-- Notification channels -->
|
||||||
|
Loading…
Reference in New Issue
Block a user