From af4926d614e9cab008fb401748e863500a204e34 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Thu, 22 Nov 2018 21:19:08 +0100 Subject: [PATCH] Fix #353 Signed-off-by: Mario Danic --- .../talk/adapters/items/UserItem.java | 55 ++++++++--- .../res/drawable/ic_call_grey_600_24dp.xml | 25 +++++ .../res/drawable/ic_mic_grey_600_24dp.xml | 25 +++++ .../drawable/ic_videocam_grey_600_24dp.xml | 25 +++++ .../main/res/drawable/shape_call_bubble.xml | 30 ++++++ .../main/res/drawable/shape_video_bubble.xml | 30 ++++++ .../main/res/drawable/shape_voice_bubble.xml | 30 ++++++ .../rv_item_conversation_info_participant.xml | 94 +++++++++++++++++++ 8 files changed, 302 insertions(+), 12 deletions(-) create mode 100644 app/src/main/res/drawable/ic_call_grey_600_24dp.xml create mode 100644 app/src/main/res/drawable/ic_mic_grey_600_24dp.xml create mode 100644 app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml create mode 100644 app/src/main/res/drawable/shape_call_bubble.xml create mode 100644 app/src/main/res/drawable/shape_video_bubble.xml create mode 100644 app/src/main/res/drawable/shape_voice_bubble.xml create mode 100644 app/src/main/res/layout/rv_item_conversation_info_participant.xml 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 d627e68e0..45c2ec79b 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 @@ -20,9 +20,13 @@ package com.nextcloud.talk.adapters.items; +import android.content.Context; +import android.content.res.Resources; +import android.media.Image; import android.text.TextUtils; import android.util.Log; import android.view.View; +import android.widget.ImageView; import android.widget.TextView; import com.amulyakhare.textdrawable.TextDrawable; @@ -106,7 +110,7 @@ public class UserItem extends AbstractFlexibleItem if (header != null) { return R.layout.rv_item_contact; } else { - return R.layout.rv_item_mention; + return R.layout.rv_item_conversation_info_participant; } } @@ -177,17 +181,38 @@ public class UserItem extends AbstractFlexibleItem holder.itemView.setAlpha(1.0f); } - // TODO: show what the user is doing currently - long participantFlags = participant.getParticipantFlags(); - if (participantFlags == 0) { - } else if (participantFlags == 1) { - // do nothing, just in call - } else if (participantFlags == 2) { - // with audio - } else if (participantFlags == 4) { - // with video - } else if (participantFlags == 7) { - // video and audio + Resources resources = NextcloudTalkApplication.getSharedApplication().getResources(); + + if (header == null) { + long participantFlags = participant.getParticipantFlags(); + if (participantFlags == 0) { + holder.voiceOrSimpleCallImageView.setVisibility(View.GONE); + holder.videoCallImageView.setVisibility(View.GONE); + } else if (participantFlags == 1) { + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.GONE); + } else if (participantFlags == 3) { + // with audio + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.GONE); + } else if (participantFlags == 5) { + // with video + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_call_bubble)); + holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.VISIBLE); + } else if (participantFlags == 7) { + // video and audio + holder.voiceOrSimpleCallImageView.setBackground(resources.getDrawable(R.drawable.shape_voice_bubble)); + holder.videoCallImageView.setBackground(resources.getDrawable(R.drawable.shape_video_bubble)); + holder.voiceOrSimpleCallImageView.setVisibility(View.VISIBLE); + holder.videoCallImageView.setVisibility(View.VISIBLE); + } else { + holder.voiceOrSimpleCallImageView.setVisibility(View.GONE); + holder.videoCallImageView.setVisibility(View.GONE); + } } String userType = ""; @@ -244,6 +269,12 @@ public class UserItem extends AbstractFlexibleItem @Nullable @BindView(R.id.secondary_text) public TextView contactMentionId; + @Nullable + @BindView(R.id.voiceOrSimpleCallImageView) + ImageView voiceOrSimpleCallImageView; + @Nullable + @BindView(R.id.videoCallImageView) + ImageView videoCallImageView; /** * Default constructor. diff --git a/app/src/main/res/drawable/ic_call_grey_600_24dp.xml b/app/src/main/res/drawable/ic_call_grey_600_24dp.xml new file mode 100644 index 000000000..7cf4380b5 --- /dev/null +++ b/app/src/main/res/drawable/ic_call_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml b/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml new file mode 100644 index 000000000..5a4a52926 --- /dev/null +++ b/app/src/main/res/drawable/ic_mic_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml b/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml new file mode 100644 index 000000000..24f2e644f --- /dev/null +++ b/app/src/main/res/drawable/ic_videocam_grey_600_24dp.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/app/src/main/res/drawable/shape_call_bubble.xml b/app/src/main/res/drawable/shape_call_bubble.xml new file mode 100644 index 000000000..8a583962f --- /dev/null +++ b/app/src/main/res/drawable/shape_call_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ 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 new file mode 100644 index 000000000..9351e5f46 --- /dev/null +++ b/app/src/main/res/drawable/shape_video_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_voice_bubble.xml b/app/src/main/res/drawable/shape_voice_bubble.xml new file mode 100644 index 000000000..88469dfbf --- /dev/null +++ b/app/src/main/res/drawable/shape_voice_bubble.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 000000000..da4e500e9 --- /dev/null +++ b/app/src/main/res/layout/rv_item_conversation_info_participant.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + +