From 973ad55dfe91751a7ee4c61609868a118551d991 Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 2 Dec 2020 11:37:20 -0500 Subject: [PATCH] Fix various UI issues with group calling PIPs. --- .../securesms/components/webrtc/CallParticipantView.java | 4 +++- .../securesms/components/webrtc/CallParticipantsState.java | 6 +++--- .../securesms/components/webrtc/WebRtcCallView.java | 4 ++-- .../layout/webrtc_call_participant_recycler_empty_item.xml | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantView.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantView.java index 0c907f60f3..9315cdbd5e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantView.java @@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.components.AvatarImageView; import org.thoughtcrime.securesms.contacts.avatars.ContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.FallbackContactPhoto; +import org.thoughtcrime.securesms.contacts.avatars.ProfileContactPhoto; import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto; import org.thoughtcrime.securesms.events.CallParticipant; import org.thoughtcrime.securesms.mms.GlideApp; @@ -130,7 +131,8 @@ public class CallParticipantView extends ConstraintLayout { } private void setPipAvatar(@NonNull Recipient recipient) { - ContactPhoto contactPhoto = recipient.getContactPhoto(); + ContactPhoto contactPhoto = recipient.isSelf() ? new ProfileContactPhoto(Recipient.self(), Recipient.self().getProfileAvatar()) + : recipient.getContactPhoto(); FallbackContactPhoto fallbackPhoto = recipient.getFallbackContactPhoto(FALLBACK_PHOTO_PROVIDER); GlideApp.with(this) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java index a72e0b57a2..a23bc0fdcd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsState.java @@ -240,7 +240,7 @@ public final class CallParticipantsState { int numberOfRemoteParticipants, boolean isViewingFocusedParticipant) { - boolean displayLocal = isNonIdleGroupCall || (!isInPip && localParticipant.isVideoEnabled()); + boolean displayLocal = (numberOfRemoteParticipants == 0 || !isInPip) && (isNonIdleGroupCall || localParticipant.isVideoEnabled()); WebRtcLocalRenderState localRenderState = WebRtcLocalRenderState.GONE; if (displayLocal || showVideoForOutgoing) { @@ -250,10 +250,10 @@ public final class CallParticipantsState { } else if (numberOfRemoteParticipants == 1) { localRenderState = WebRtcLocalRenderState.SMALL_RECTANGLE; } else { - localRenderState = WebRtcLocalRenderState.LARGE; + localRenderState = localParticipant.isVideoEnabled() ? WebRtcLocalRenderState.LARGE : WebRtcLocalRenderState.LARGE_NO_VIDEO; } } else if (callState != WebRtcViewModel.State.CALL_INCOMING && callState != WebRtcViewModel.State.CALL_DISCONNECTED) { - localRenderState = WebRtcLocalRenderState.LARGE; + localRenderState = localParticipant.isVideoEnabled() ? WebRtcLocalRenderState.LARGE : WebRtcLocalRenderState.LARGE_NO_VIDEO; } } else if (callState == WebRtcViewModel.State.CALL_PRE_JOIN) { localRenderState = WebRtcLocalRenderState.LARGE_NO_VIDEO; diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java index 12ce675977..e1180fcac9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java @@ -272,7 +272,7 @@ public class WebRtcCallView extends FrameLayout { recyclerAdapter.submitList(state.getListParticipants()); updateLocalCallParticipant(state.getLocalRenderState(), state.getLocalParticipant()); - if (state.isLargeVideoGroup()) { + if (state.isLargeVideoGroup() && !state.isInPipMode()) { layoutParticipantsForLargeCount(); } else { layoutParticipantsForSmallCount(); @@ -521,7 +521,7 @@ public class WebRtcCallView extends FrameLayout { pictureInPictureGestureHelper.lockToBottomEnd(); pictureInPictureGestureHelper.performAfterFling(() -> { - ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, ViewUtil.dpToPx(40), ViewUtil.dpToPx(72)); + ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, ViewUtil.dpToPx(54), ViewUtil.dpToPx(72)); animation.setDuration(PIP_RESIZE_DURATION); animation.setAnimationListener(new SimpleAnimationListener() { @Override diff --git a/app/src/main/res/layout/webrtc_call_participant_recycler_empty_item.xml b/app/src/main/res/layout/webrtc_call_participant_recycler_empty_item.xml index ba2db29b72..6a7e92f908 100644 --- a/app/src/main/res/layout/webrtc_call_participant_recycler_empty_item.xml +++ b/app/src/main/res/layout/webrtc_call_participant_recycler_empty_item.xml @@ -1,7 +1,7 @@ \ No newline at end of file