Fix overlap of join banner and camera toggle.

This commit is contained in:
Alex Hart 2024-09-11 10:54:44 -03:00 committed by Cody Henthorne
parent 7735ca9dab
commit baa6032770
5 changed files with 38 additions and 44 deletions

View file

@ -83,7 +83,7 @@ class PendingParticipantsBottomSheet : ComposeBottomSheetDialogFragment() {
}
val participants = viewModel.pendingParticipants
.map { it.getAllPendingParticipants(launchTime).toList() }
.map { it.pendingParticipantCollection.getAllPendingParticipants(launchTime).toList() }
.subscribeAsState(initial = emptyList())
PendingParticipantsSheet(

View file

@ -60,7 +60,7 @@ import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.ringrtc.CameraState;
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection;
import org.thoughtcrime.securesms.service.webrtc.state.PendingParticipantsState;
import org.thoughtcrime.securesms.stories.viewer.reply.reaction.MultiReactionBurstLayout;
import org.thoughtcrime.securesms.util.BlurTransformation;
import org.thoughtcrime.securesms.util.ThrottledDebouncer;
@ -446,15 +446,20 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
pendingParticipantsViewListener = listener;
}
public void updatePendingParticipantsList(@NonNull PendingParticipantCollection pendingParticipantCollection) {
if (pendingParticipantCollection.getUnresolvedPendingParticipants().isEmpty()) {
public void updatePendingParticipantsList(@NonNull PendingParticipantsState state) {
if (state.isInPipMode()) {
pendingParticipantsViewStub.setVisibility(View.GONE);
return;
}
if (state.getPendingParticipantCollection().getUnresolvedPendingParticipants().isEmpty()) {
if (pendingParticipantsViewStub.resolved()) {
pendingParticipantsViewStub.get().setListener(pendingParticipantsViewListener);
pendingParticipantsViewStub.get().applyState(pendingParticipantCollection);
pendingParticipantsViewStub.get().applyState(state.getPendingParticipantCollection());
}
} else {
pendingParticipantsViewStub.get().setListener(pendingParticipantsViewListener);
pendingParticipantsViewStub.get().applyState(pendingParticipantCollection);
pendingParticipantsViewStub.get().applyState(state.getPendingParticipantCollection());
}
}
@ -525,10 +530,8 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
updateLocalCallParticipant(state.getLocalRenderState(), state.getLocalParticipant(), displaySmallSelfPipInLandscape);
if (state.isLargeVideoGroup()) {
moveSnackbarAboveParticipantRail(true);
adjustLayoutForLargeCount();
} else {
moveSnackbarAboveParticipantRail(state.isViewingFocusedParticipant());
adjustLayoutForSmallCount();
}
}
@ -647,14 +650,6 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
setStatus(getContext().getString(statusRes));
}
private @NonNull View getPipBarrier() {
if (collapsedToolbar.isEnabled()) {
return collapsedToolbar;
} else {
return largeHeader;
}
}
public void setStatusFromHangupType(@NonNull HangupMessage.Type hangupType) {
switch (hangupType) {
case NORMAL:
@ -904,28 +899,6 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
constraintSet.applyTo(this);
}
private void moveSnackbarAboveParticipantRail(boolean aboveRail) {
if (aboveRail) {
updatePendingParticipantsBottomConstraint(callParticipantsRecycler);
} else {
updatePendingParticipantsBottomConstraint(aboveControlsGuideline);
}
}
private void updatePendingParticipantsBottomConstraint(View anchor) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.setForceId(false);
constraintSet.clone(this);
constraintSet.connect(R.id.call_screen_pending_recipients,
ConstraintSet.BOTTOM,
anchor.getId(),
ConstraintSet.TOP,
ViewUtil.dpToPx(8));
constraintSet.applyTo(this);
}
private void fadeInNewUiState(boolean showSmallHeader) {
for (View view : SetUtil.difference(allTimeVisibleViews, visibleViewSet)) {
view.setVisibility(GONE);

View file

@ -33,6 +33,7 @@ import org.thoughtcrime.securesms.recipients.LiveRecipient;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection;
import org.thoughtcrime.securesms.service.webrtc.state.PendingParticipantsState;
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcEphemeralState;
import org.thoughtcrime.securesms.util.NetworkUtil;
import org.thoughtcrime.securesms.util.SingleLiveEvent;
@ -220,8 +221,12 @@ public class WebRtcCallViewModel extends ViewModel {
return callStarting;
}
public @NonNull Observable<PendingParticipantCollection> getPendingParticipants() {
return pendingParticipants.observeOn(AndroidSchedulers.mainThread());
public @NonNull Observable<PendingParticipantsState> getPendingParticipants() {
Observable<Boolean> isInPipMode = participantsState
.map(CallParticipantsState::isInPipMode)
.distinctUntilChanged();
return Observable.combineLatest(pendingParticipants, isInPipMode, PendingParticipantsState::new);
}
public @NonNull PendingParticipantCollection getPendingParticipantsSnapshot() {

View file

@ -0,0 +1,16 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.service.webrtc.state
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection
/**
* Represents the current state of the pending participants card.
*/
data class PendingParticipantsState(
val pendingParticipantCollection: PendingParticipantCollection,
val isInPipMode: Boolean
)

View file

@ -56,19 +56,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
app:layout_goneMarginBottom="32dp"
app:layout_constraintBottom_toTopOf="@id/call_screen_pending_recipients"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_goneMarginBottom="32dp" />
<ViewStub
android:id="@+id/call_screen_pending_recipients"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="32dp"
android:layout_marginBottom="16dp"
android:inflatedId="@+id/call_screen_pending_recipients"
android:layout="@layout/call_screen_pending_participants_view"
app:layout_constraintBottom_toTopOf="@id/call_screen_participants_overflow_guideline"
app:layout_constraintBottom_toTopOf="@id/call_screen_above_controls_barrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />