Skip to content

Commit baa6032

Browse files
alex-signalcody-signal
authored andcommitted
Fix overlap of join banner and camera toggle.
1 parent 7735ca9 commit baa6032

5 files changed

Lines changed: 38 additions & 44 deletions

File tree

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PendingParticipantsBottomSheet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PendingParticipantsBottomSheet : ComposeBottomSheetDialogFragment() {
8383
}
8484

8585
val participants = viewModel.pendingParticipants
86-
.map { it.getAllPendingParticipants(launchTime).toList() }
86+
.map { it.pendingParticipantCollection.getAllPendingParticipants(launchTime).toList() }
8787
.subscribeAsState(initial = emptyList())
8888

8989
PendingParticipantsSheet(

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
import org.thoughtcrime.securesms.recipients.Recipient;
6161
import org.thoughtcrime.securesms.recipients.RecipientId;
6262
import org.thoughtcrime.securesms.ringrtc.CameraState;
63-
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection;
63+
import org.thoughtcrime.securesms.service.webrtc.state.PendingParticipantsState;
6464
import org.thoughtcrime.securesms.stories.viewer.reply.reaction.MultiReactionBurstLayout;
6565
import org.thoughtcrime.securesms.util.BlurTransformation;
6666
import org.thoughtcrime.securesms.util.ThrottledDebouncer;
@@ -446,15 +446,20 @@ public void setPendingParticipantsViewListener(@Nullable PendingParticipantsView
446446
pendingParticipantsViewListener = listener;
447447
}
448448

449-
public void updatePendingParticipantsList(@NonNull PendingParticipantCollection pendingParticipantCollection) {
450-
if (pendingParticipantCollection.getUnresolvedPendingParticipants().isEmpty()) {
449+
public void updatePendingParticipantsList(@NonNull PendingParticipantsState state) {
450+
if (state.isInPipMode()) {
451+
pendingParticipantsViewStub.setVisibility(View.GONE);
452+
return;
453+
}
454+
455+
if (state.getPendingParticipantCollection().getUnresolvedPendingParticipants().isEmpty()) {
451456
if (pendingParticipantsViewStub.resolved()) {
452457
pendingParticipantsViewStub.get().setListener(pendingParticipantsViewListener);
453-
pendingParticipantsViewStub.get().applyState(pendingParticipantCollection);
458+
pendingParticipantsViewStub.get().applyState(state.getPendingParticipantCollection());
454459
}
455460
} else {
456461
pendingParticipantsViewStub.get().setListener(pendingParticipantsViewListener);
457-
pendingParticipantsViewStub.get().applyState(pendingParticipantCollection);
462+
pendingParticipantsViewStub.get().applyState(state.getPendingParticipantCollection());
458463
}
459464
}
460465

@@ -525,10 +530,8 @@ public void updateCallParticipants(@NonNull CallParticipantsViewState callPartic
525530
updateLocalCallParticipant(state.getLocalRenderState(), state.getLocalParticipant(), displaySmallSelfPipInLandscape);
526531

527532
if (state.isLargeVideoGroup()) {
528-
moveSnackbarAboveParticipantRail(true);
529533
adjustLayoutForLargeCount();
530534
} else {
531-
moveSnackbarAboveParticipantRail(state.isViewingFocusedParticipant());
532535
adjustLayoutForSmallCount();
533536
}
534537
}
@@ -647,14 +650,6 @@ private void setStatus(@StringRes int statusRes) {
647650
setStatus(getContext().getString(statusRes));
648651
}
649652

650-
private @NonNull View getPipBarrier() {
651-
if (collapsedToolbar.isEnabled()) {
652-
return collapsedToolbar;
653-
} else {
654-
return largeHeader;
655-
}
656-
}
657-
658653
public void setStatusFromHangupType(@NonNull HangupMessage.Type hangupType) {
659654
switch (hangupType) {
660655
case NORMAL:
@@ -904,28 +899,6 @@ private void adjustLayoutPositions(@NonNull LayoutPositions layoutPositions) {
904899
constraintSet.applyTo(this);
905900
}
906901

907-
private void moveSnackbarAboveParticipantRail(boolean aboveRail) {
908-
if (aboveRail) {
909-
updatePendingParticipantsBottomConstraint(callParticipantsRecycler);
910-
} else {
911-
updatePendingParticipantsBottomConstraint(aboveControlsGuideline);
912-
}
913-
}
914-
915-
private void updatePendingParticipantsBottomConstraint(View anchor) {
916-
ConstraintSet constraintSet = new ConstraintSet();
917-
constraintSet.setForceId(false);
918-
constraintSet.clone(this);
919-
920-
constraintSet.connect(R.id.call_screen_pending_recipients,
921-
ConstraintSet.BOTTOM,
922-
anchor.getId(),
923-
ConstraintSet.TOP,
924-
ViewUtil.dpToPx(8));
925-
926-
constraintSet.applyTo(this);
927-
}
928-
929902
private void fadeInNewUiState(boolean showSmallHeader) {
930903
for (View view : SetUtil.difference(allTimeVisibleViews, visibleViewSet)) {
931904
view.setVisibility(GONE);

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallViewModel.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.thoughtcrime.securesms.recipients.Recipient;
3434
import org.thoughtcrime.securesms.recipients.RecipientId;
3535
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection;
36+
import org.thoughtcrime.securesms.service.webrtc.state.PendingParticipantsState;
3637
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcEphemeralState;
3738
import org.thoughtcrime.securesms.util.NetworkUtil;
3839
import org.thoughtcrime.securesms.util.SingleLiveEvent;
@@ -220,8 +221,12 @@ public boolean isCallStarting() {
220221
return callStarting;
221222
}
222223

223-
public @NonNull Observable<PendingParticipantCollection> getPendingParticipants() {
224-
return pendingParticipants.observeOn(AndroidSchedulers.mainThread());
224+
public @NonNull Observable<PendingParticipantsState> getPendingParticipants() {
225+
Observable<Boolean> isInPipMode = participantsState
226+
.map(CallParticipantsState::isInPipMode)
227+
.distinctUntilChanged();
228+
229+
return Observable.combineLatest(pendingParticipants, isInPipMode, PendingParticipantsState::new);
225230
}
226231

227232
public @NonNull PendingParticipantCollection getPendingParticipantsSnapshot() {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2024 Signal Messenger, LLC
3+
* SPDX-License-Identifier: AGPL-3.0-only
4+
*/
5+
6+
package org.thoughtcrime.securesms.service.webrtc.state
7+
8+
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection
9+
10+
/**
11+
* Represents the current state of the pending participants card.
12+
*/
13+
data class PendingParticipantsState(
14+
val pendingParticipantCollection: PendingParticipantCollection,
15+
val isInPipMode: Boolean
16+
)

app/src/main/res/layout/webrtc_call_controls.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@
5656
android:layout_width="wrap_content"
5757
android:layout_height="wrap_content"
5858
android:layout_marginBottom="12dp"
59-
app:layout_goneMarginBottom="32dp"
6059
app:layout_constraintBottom_toTopOf="@id/call_screen_pending_recipients"
61-
app:layout_constraintEnd_toEndOf="parent" />
60+
app:layout_constraintEnd_toEndOf="parent"
61+
app:layout_goneMarginBottom="32dp" />
6262

6363
<ViewStub
6464
android:id="@+id/call_screen_pending_recipients"
6565
android:layout_width="match_parent"
6666
android:layout_height="wrap_content"
6767
android:layout_marginHorizontal="16dp"
68-
android:layout_marginBottom="32dp"
68+
android:layout_marginBottom="16dp"
6969
android:inflatedId="@+id/call_screen_pending_recipients"
7070
android:layout="@layout/call_screen_pending_participants_view"
71-
app:layout_constraintBottom_toTopOf="@id/call_screen_participants_overflow_guideline"
71+
app:layout_constraintBottom_toTopOf="@id/call_screen_above_controls_barrier"
7272
app:layout_constraintEnd_toEndOf="parent"
7373
app:layout_constraintStart_toStartOf="parent" />
7474

0 commit comments

Comments
 (0)