diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java index ce7e18358..f895be480 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/UserItem.java @@ -37,6 +37,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication; import com.nextcloud.talk.models.database.UserEntity; import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter; 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.DisplayUtils; @@ -186,56 +187,24 @@ public class UserItem extends AbstractFlexibleItem Resources resources = NextcloudTalkApplication.Companion.getSharedApplication().getResources(); if (header == null) { - Participant.ParticipantFlags participantFlags = participant.getParticipantFlags(); - switch (participantFlags) { - case NOT_IN_CALL: - holder.voiceOrSimpleCallImageView.setVisibility(View.GONE); - holder.videoCallImageView.setVisibility(View.GONE); - break; - case IN_CALL: - holder.voiceOrSimpleCallImageView.setBackground( - ResourcesCompat.getDrawable(resources, R.drawable.shape_call_bubble, null)); - holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); - holder.voiceOrSimpleCallImageView.setContentDescription( - resources.getString(R.string.nc_call_state_in_call, participant.displayName)); - holder.videoCallImageView.setVisibility(View.GONE); - break; - case IN_CALL_WITH_AUDIO: - holder.voiceOrSimpleCallImageView.setBackground( - ResourcesCompat.getDrawable(resources, R.drawable.shape_voice_bubble, null)); - holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); - 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; + Long inCallFlag = participant.getInCall(); + if ((inCallFlag & InCallFlags.WITH_PHONE) > 0) { + holder.videoCallIconView.setImageResource(R.drawable.ic_call_grey_600_24dp); + holder.videoCallIconView.setVisibility(View.VISIBLE); + holder.videoCallIconView.setContentDescription( + resources.getString(R.string.nc_call_state_with_phone, participant.displayName)); + } else if ((inCallFlag & InCallFlags.WITH_VIDEO) > 0) { + holder.videoCallIconView.setImageResource(R.drawable.ic_videocam_grey_600_24dp); + holder.videoCallIconView.setVisibility(View.VISIBLE); + holder.videoCallIconView.setContentDescription( + resources.getString(R.string.nc_call_state_with_video, participant.displayName)); + } else if (inCallFlag > InCallFlags.DISCONNECTED) { + holder.videoCallIconView.setImageResource(R.drawable.ic_mic_grey_600_24dp); + holder.videoCallIconView.setVisibility(View.VISIBLE); + holder.videoCallIconView.setContentDescription( + resources.getString(R.string.nc_call_state_in_call, participant.displayName)); + } else { + holder.videoCallIconView.setVisibility(View.GONE); } if (holder.contactMentionId != null) { @@ -302,11 +271,8 @@ public class UserItem extends AbstractFlexibleItem @BindView(R.id.secondary_text) public EmojiTextView contactMentionId; @Nullable - @BindView(R.id.voiceOrSimpleCallImageView) - ImageView voiceOrSimpleCallImageView; - @Nullable - @BindView(R.id.videoCallImageView) - ImageView videoCallImageView; + @BindView(R.id.videoCallIcon) + ImageView videoCallIconView; @Nullable @BindView(R.id.checkedImageView) ImageView checkedImageView; diff --git a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java index ffd74e34e..35bf9fb58 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/participants/Participant.java @@ -146,8 +146,19 @@ public class Participant { return sessionIds; } - public Object getInCall() { - return this.inCall; + public Long getInCall() { + 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() { @@ -327,6 +338,15 @@ public class Participant { 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 { NOT_IN_CALL(0), IN_CALL(1), diff --git a/app/src/main/res/drawable/shape_call_bubble.xml b/app/src/main/res/drawable/shape_call_bubble.xml deleted file mode 100644 index c41afbad1..000000000 --- a/app/src/main/res/drawable/shape_call_bubble.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable/shape_favorite_bubble.xml b/app/src/main/res/drawable/shape_favorite_bubble.xml deleted file mode 100644 index 70e102dbd..000000000 --- a/app/src/main/res/drawable/shape_favorite_bubble.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_lock_bubble.xml b/app/src/main/res/drawable/shape_lock_bubble.xml deleted file mode 100644 index 9d10e9545..000000000 --- a/app/src/main/res/drawable/shape_lock_bubble.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_video_bubble.xml b/app/src/main/res/drawable/shape_video_bubble.xml deleted file mode 100644 index eb35cfc2e..000000000 --- a/app/src/main/res/drawable/shape_video_bubble.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable/shape_voice_bubble.xml b/app/src/main/res/drawable/shape_voice_bubble.xml deleted file mode 100644 index 851328b2d..000000000 --- a/app/src/main/res/drawable/shape_voice_bubble.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/layout/rv_item_conversation_info_participant.xml b/app/src/main/res/layout/rv_item_conversation_info_participant.xml index 3996386e7..810b8a41d 100644 --- a/app/src/main/res/layout/rv_item_conversation_info_participant.xml +++ b/app/src/main/res/layout/rv_item_conversation_info_participant.xml @@ -25,40 +25,27 @@ android:layout_height="@dimen/item_height" android:orientation="vertical"> - + android:layout_marginStart="@dimen/activity_horizontal_margin" + app:roundAsCircle="true" /> - - - - - - - + Currently offline, please check your connectivity Leaving call… %1$s in call - %1$s in call with audio + %1$s with phone %1$s with video