Implement several polish items for Call Links.

This commit is contained in:
Alex Hart 2024-01-23 15:50:47 -04:00 committed by Nicholas Tinsley
parent 56a2d8891f
commit 4ada7c9be9
7 changed files with 42 additions and 29 deletions

View file

@ -20,7 +20,7 @@ enum class LayoutPositions(
SMALL_GROUP(
participantBottomViewId = ConstraintSet.PARENT_ID,
participantBottomMargin = 0,
reactionBottomViewId = R.id.call_screen_above_controls_guideline,
reactionBottomViewId = R.id.call_screen_pending_recipients,
reactionBottomMargin = 8
),
@ -28,7 +28,7 @@ enum class LayoutPositions(
LARGE_GROUP(
participantBottomViewId = R.id.call_screen_participants_recycler,
participantBottomMargin = 16,
reactionBottomViewId = R.id.call_screen_participants_recycler,
reactionBottomViewId = R.id.call_screen_pending_recipients,
reactionBottomMargin = 20
);

View file

@ -25,6 +25,7 @@ import androidx.annotation.StringRes;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
import androidx.compose.ui.platform.ComposeView;
import androidx.constraintlayout.widget.Barrier;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Guideline;
@ -124,6 +125,7 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
private RecyclerView groupReactionsFeed;
private MultiReactionBurstLayout reactionViews;
private ComposeView raiseHandSnackbar;
private Barrier pipBottomBoundaryBarrier;
@ -203,6 +205,7 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
groupReactionsFeed = findViewById(R.id.call_screen_reactions_feed);
reactionViews = findViewById(R.id.call_screen_reactions_container);
raiseHandSnackbar = findViewById(R.id.call_screen_raise_hand_view);
pipBottomBoundaryBarrier = findViewById(R.id.pip_bottom_boundary_barrier);
View decline = findViewById(R.id.call_screen_decline_call);
View answerLabel = findViewById(R.id.call_screen_answer_call_label);
@ -355,6 +358,12 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
rotatableControls.add(decline);
rotatableControls.add(smallLocalAudioIndicator);
rotatableControls.add(ringToggle);
pipBottomBoundaryBarrier.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
if (bottom != oldBottom) {
onBarrierBottomChanged(bottom);
}
});
}
@Override
@ -851,17 +860,17 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
private void moveSnackbarAboveParticipantRail(boolean aboveRail) {
if (aboveRail) {
updateSnackbarBottomConstraint(callParticipantsRecycler);
updatePendingParticipantsBottomConstraint(callParticipantsRecycler);
} else {
updateSnackbarBottomConstraint(aboveControlsGuideline);
updatePendingParticipantsBottomConstraint(aboveControlsGuideline);
}
}
private void updateSnackbarBottomConstraint(View anchor) {
private void updatePendingParticipantsBottomConstraint(View anchor) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(this);
constraintSet.connect(R.id.call_screen_raise_hand_view,
constraintSet.connect(R.id.call_screen_pending_recipients,
ConstraintSet.BOTTOM,
anchor.getId(),
ConstraintSet.TOP,
@ -938,15 +947,12 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
ringToggle.setActivated(enabled);
}
public void onControlTopChanged(int guidelineTop, int snackBarHeight) {
int offset = 0;
if (lastState != null) {
CallParticipantsState state = lastState.getCallParticipantsState();
if (!state.isViewingFocusedParticipant() && !state.isLargeVideoGroup()) {
offset = snackBarHeight;
}
pictureInPictureGestureHelper.setBottomVerticalBoundary(guidelineTop - offset);
}
public void onControlTopChanged() {
onBarrierBottomChanged(pipBottomBoundaryBarrier.getBottom());
}
private void onBarrierBottomChanged(int barrierBottom) {
pictureInPictureGestureHelper.setBottomVerticalBoundary(barrierBottom);
}
public interface ControlsListener {

View file

@ -147,8 +147,8 @@ class ControlsAndInfoController(
webRtcCallView.post { onControlTopChanged() }
}
raiseHandComposeView.addOnLayoutChangeListener { _, _, top, _, bottom, _, _, _, _ ->
onControlTopChanged(composeViewSize = bottom - top)
raiseHandComposeView.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
onControlTopChanged()
}
callControls.viewTreeObserver.addOnGlobalLayoutListener {
@ -184,8 +184,6 @@ class ControlsAndInfoController(
callInfoComposeView.alpha = alphaCallInfo(slideOffset)
callInfoComposeView.translationY = infoTranslationDistance - (infoTranslationDistance * callInfoComposeView.alpha)
onControlTopChanged()
}
})
@ -210,10 +208,10 @@ class ControlsAndInfoController(
}
}
fun onControlTopChanged(composeViewSize: Int = raiseHandComposeView.height) {
fun onControlTopChanged() {
val guidelineTop = max(frame.top, coordinator.height - behavior.peekHeight)
aboveControlsGuideline.setGuidelineBegin(guidelineTop)
webRtcCallView.onControlTopChanged(guidelineTop, composeViewSize)
webRtcCallView.onControlTopChanged()
}
fun addVisibilityListener(listener: BottomSheetVisibilityListener): Boolean {

View file

@ -120,7 +120,7 @@ private fun RaiseHand(
modifier = modifier
.padding(horizontal = 16.dp)
.clip(shape = RoundedCornerShape(16.dp, 16.dp, 16.dp, 16.dp))
.background(MaterialTheme.colorScheme.surface)
.background(SignalTheme.colors.colorSurface1)
.animateContentSize()
) {
val boxModifier = modifier

View file

@ -4,11 +4,12 @@
-->
<org.thoughtcrime.securesms.components.webrtc.PendingParticipantsView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/call_screen_pending_recipients"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="32dp"
android:minHeight="72dp"
app:cardBackgroundColor="@color/signal_colorSurface3"
app:cardBackgroundColor="@color/signal_colorSurface1"
app:cardCornerRadius="18dp"
app:cardElevation="0dp" />

View file

@ -8,7 +8,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="72dp"
app:cardBackgroundColor="@color/signal_colorSurface3"
app:cardBackgroundColor="@color/signal_colorSurface1"
app:cardCornerRadius="18dp"
app:cardElevation="0dp"
tools:layout_marginHorizontal="24dp"

View file

@ -106,7 +106,7 @@
android:orientation="vertical"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@+id/call_screen_above_controls_guideline"
app:layout_constraintBottom_toTopOf="@+id/call_screen_pending_recipients"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -369,9 +369,9 @@
android:id="@+id/call_screen_pending_recipients"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="32dp"
android:inflatedId="@+id/call_screen_pending_recipients_view"
android:inflatedId="@+id/call_screen_pending_recipients"
android:layout="@layout/call_screen_pending_participants_view"
app:layout_constraintBottom_toTopOf="@id/call_screen_above_controls_guideline"
app:layout_constraintEnd_toEndOf="parent"
@ -400,8 +400,16 @@
android:id="@+id/call_screen_raise_hand_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/call_screen_above_controls_guideline"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="@id/call_screen_pending_recipients"
app:layout_constraintEnd_toEndOf="parent" />
<include layout="@layout/webrtc_call_controls"/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/pip_bottom_boundary_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="top"
app:constraint_referenced_ids="call_screen_raise_hand_view,call_screen_pending_recipients,call_screen_above_controls_guideline" />
</merge>